package com.pucheng.bracelet.app.base

import android.os.Bundle
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.pucheng.bracelet.R
import com.pucheng.bracelet.app.util.StatusBarUtil
import com.pucheng.bracelet.app.util.click
import kotlinx.android.synthetic.main.activity_base_history_to_list.*
import kotlinx.android.synthetic.main.layout_title2.*
import me.hgj.jetpackmvvm.base.activity.BaseVmActivity
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel

abstract class BaseHistoryToListActivity<VM : BaseViewModel, T> : BaseVmActivity<VM>() {
    override fun layoutId(): Int = R.layout.activity_base_history_to_list

    override fun initView(savedInstanceState: Bundle?) {
        StatusBarUtil.setColor(this, resources.getColor(R.color.white),20)
        rv_history.adapter = getHistoryAdapter()
        tv_title.text = getString(titleResId())
        ibtn_back.click { finish() }
    }

    abstract fun getHistoryAdapter(): BaseQuickAdapter<T, BaseViewHolder>

    /**
     * 创建liveData观察者
     */
    override fun createObserver() {}

    abstract fun titleResId(): Int
    override fun dismissLoading() {
    }

    override fun showLoading(message: String) {
    }
}